package com.no1.zy.rabbitmq.fair;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class FairProducer {
    @Autowired
    private AmqpTemplate amqpTemplate;

    public void send(int times) {
        for (int i = 0; i < times; i++) {
            String msg = "fair queue!";
            System.out.println("生产者发送消息 msg——》" + msg);
            amqpTemplate.convertAndSend("my_fair_queue", msg);
        }
    }
}
